%!Tex Program = xelatex
\documentclass[a4paper,twoside,openright,notitlepage]{ctexbook}
%\documentclass[a4paper,fontset=none]{ctexbook}
%\ctexset{fontset=ubuntu} %设定CTeX宏包所采用的字体配置为ubuntu

\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{listings}
%\usepackage{xcolor}
\usepackage{amssymb,amsfonts,amsmath,amsthm}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{fancyhdr}
\usepackage{ulem}
\usepackage{array}
\usepackage{booktabs}
\usepackage{mathrsfs}
\usepackage{CJKfntef}

%%% Tikz PIC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes.geometric}
%\pagestyle{empty}

\pgfdeclarelayer{edgelayer}
\pgfdeclarelayer{nodelayer}
\pgfsetlayers{edgelayer,nodelayer,main}

\tikzstyle{none}=[inner sep=0pt]

\tikzstyle{wn}=[circle,fill=White,draw=Black,line width=0.8 pt]
\tikzstyle{rn}=[circle,fill=Red,draw=Black,line width=0.8 pt]
\tikzstyle{gn}=[circle,fill=Lime,draw=Black,line width=0.8 pt]
\tikzstyle{yn}=[circle,fill=Yellow,draw=Black,line width=0.8 pt]
\tikzstyle{newstyle}=[circle,fill=White,draw=Black]

\tikzstyle{simple}=[-,draw=Black,line width=2.000]
\tikzstyle{arrow}=[-,draw=Black,postaction={decorate},decoration={markings,mark=at position .5 with {\arrow{>}}},line width=2.000]
\tikzstyle{tick}=[-,draw=Black,postaction={decorate},decoration={markings,mark=at position .5 with {\draw (0,-0.1) -- (0,0.1);}},line width=2.000]

%\usepackage[graphics,tightpage,active]{preview}
%\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\lstdefinestyle{lfonts}{
basicstyle = \footnotesize\ttfamily,
stringstyle = \color{purple},
keywordstyle = \color{blue!60!black}\bfseries,
commentstyle = \color{olive}\scshape,
}
\lstdefinestyle{lnumbers}{
numbers = left,
numberstyle = \tiny,
numbersep = 1em,
firstnumber = 1,
stepnumber = 1,
}
\lstdefinestyle{llayout}{
breaklines = true,
tabsize = 2,
columns = flexible,
}
\lstdefinestyle{lgeometry}{
xleftmargin = 20pt,
xrightmargin = 0pt,
frame = tb,
framesep = \fboxsep,
framexleftmargin = 20pt,
}
\lstdefinestyle{lgeneral}{
style = lfonts,
style = lnumbers,
style = llayout,
style = lgeometry,
}
\lstdefinestyle{python}{
language = {Python},
style = lgeneral,
}


\newcounter{alg}[chapter]
\renewcommand{\thealg}{\arabic{chapter}.\arabic{alg}}

\newtheorem{definition}{定义}[chapter]

\newtheorem{theorem}{定理}[chapter]

\newtheorem{corollary}{推论}[chapter]

\newtheorem{example}{例}[chapter]

\newtheorem{lemma}{引理}[chapter]

\renewcommand{\proofname}{\bf 证明}

%\setmainfont[Mapping=tex-text]{AR PL UMing CN:style=Light}
%\setmainfont[Mapping=tex-text]{AR PL UKai CN:style=Book}
%\setmainfont[Mapping=tex-text]{WenQuanYi Zen Hei:style=Regular}
%\setmainfont[Mapping=tex-text]{WenQuanYi Zen Hei Sharp:style=Regular}
%\setmainfont[Mapping=tex-text]{AR PL KaitiM GB:style=Regular} 
%\setmainfont[Mapping=tex-text]{AR PL SungtiL GB:style=Regular} 
%\newfontfamily\hei{WenQuanYi Micro Hei}
%\newfontfamily\whei{WenQuanYi Zen Hei}

\setCJKfamilyfont{kai}{KaiTi}
\newcommand{\kai}{\CJKfamily{kai}}
\setCJKfamilyfont{song}{SimSun}
\newcommand{\song}{\CJKfamily{song}}
\setCJKfamilyfont{fangsong}{FangSong}
\newcommand{\fs}{\CJKfamily{fangsong}}
\setCJKfamilyfont{hei}{SimHei}
\newcommand{\hei}{\CJKfamily{hei}}
%\setCJKfamilyfont{lishu}{LiSu}
%\newcommand{\lishu}{\CJKfamily{lishu}}

%\setmainfont[Mapping=tex-text]{Ubuntu}
%\setsansfont[Mapping=tex-text]{Ubuntu}
%\setmonofont[Mapping=tex-text]{Ubuntu}
%\setCJKmainfont[BoldFont = SimHei, ItalicFont = FangSong]{SimSun}

\renewcommand{\baselinestretch}{1.0}
\begin{document}
\pagestyle{empty}

\title{\hei 计算机模拟讲义}

\author{王何宇 \thanks{email:wangheyu@zju.edu.cn}\\
         数学科学学院\\
         浙江大学
       }
\maketitle
\thispagestyle{empty}

\pagestyle{headings}
\pagenumbering{Roman}

 
\tableofcontents

\include{chap01}

\include{chap02}

\include{chap03}

\include{chap04}

\include{chap05}

\include{chap06}

\bibliographystyle{plain}
\bibliography{crazyfish}
\end{document}
